package com.lixinlei.miaosha.service;

import com.lixinlei.miaosha.error.BusinessException;
import com.lixinlei.miaosha.service.model.ItemModel;

import java.util.List;

public interface ItemService {

    ItemModel createItem(ItemModel itemModel) throws BusinessException;

    List<ItemModel> listItem();

    ItemModel getItemById(Integer id);

    ItemModel getItemByIdInCache(Integer id);

    boolean decreaseStock(Integer itemId, Integer amount);

    void increaseSales(Integer itemId, Integer amount);

    /**
     * 初始化库存操作流水
     * @param itemId
     * @param amount
     */
    String initStockLog(Integer itemId, Integer amount);

}
